package com.esender.common.vo;

import com.esender.common.enums.ExceptionEnums;

public class R {
    public static ResultVO ok() {
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(0);
        resultVO.setMsg("");
        return resultVO;
    }


    public static ResultVO ok(Object data) {
        ResultVO ok = ok();
        ok.setData(data);
        return ok;
    }

    public static ResultVO ok(Long total,Object rows) {
        ResultVO ok = ok();
        ok.setTotal(total);
        ok.setRows(rows);
        return ok;
    }

    public static ResultVO error(Integer code,String msg) {
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(code);
        resultVO.setMsg(msg);
        return  resultVO;
    }

    public static ResultVO error(ExceptionEnums exceptionEnums) {
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(exceptionEnums.getCode());
        resultVO.setMsg(exceptionEnums.getMsg());
        return  resultVO;
    }
}
